# Maintainer: judd <jvinet@zeroflux.org>
pkgname=cpio
pkgver=2.13
pkgrel=2
pkgdesc="A tool to copy files into or out of a cpio or tar archive"
arch=(x86_64)
license=('GPL')
url="https://www.gnu.org/software/cpio"
depends=('glibc')
source=(https://ftp.gnu.org/gnu/cpio/cpio-${pkgver}.tar.gz{,.sig})
md5sums=('389c5452d667c23b5eceb206f5000810'
         'SKIP')
validpgpkeys=('325F650C4C2B6AD58807327A3602B07F55D0C732') # Sergey Poznyakoff <gray@gnu.org>

build() {
  cd ${pkgname}-${pkgver}
  CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
  ./configure --prefix=/usr --mandir=/usr/share/man
  make
}

check() {
  cd ${pkgname}-${pkgver}
  make check
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  rm -f "${pkgdir}/usr/bin/mt" "${pkgdir}/pkg/usr/share/man/man1/mt.1"
  rm -rf "${pkgdir}/usr/libexec"
  rm -f "${pkgdir}/usr/share/man/man8/rmt.8"
  # remove infodir
  rm "$pkgdir/usr/share/info/dir"
}
